package com.hsh.web;

import com.hsh.bean.Courier;
import com.hsh.service.CourierService;
import com.hsh.service.impl.CourierServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet(value="/courierServlet")
public class CourierServlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        CourierService courierService = new CourierServiceImpl();
        List<Courier> couriers = courierService.getCouriers();
        req.setAttribute("couriers",couriers);
        req.getRequestDispatcher("/show.jsp").forward(req,resp);
    }
}
